import { createStore } from "vuex";
import { routes } from "@/router";

const permission: any = createStore({
	state: {
		routers: routes,
		addRouters: []
	},
	mutations: {
		SET_ROUTERS: (state, routers) => {
			state.addRouters = routers;
			state.routers = routes.concat(routers)
		}
	},
	actions: {
		GenerateRoutes({ commit }, asyncRouter) {
			commit('SET_ROUTERS', asyncRouter);
		}
	},
});


export default permission;